package com.mryan.auth.dao;

import com.mryan.auth.pojo.Account;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * @description： AccountDao
 * @Author MRyan
 * @Date 2021/6/14 9:48
 * @Version 1.0
 */
@Mapper
public interface AccountDao {

    @Select("select account_password from account where account_name = #{account_name}")
    String getAccountPassword(String accountId);

    @Select("SELECT * FROM account WHERE account_name = #{accountName}")
    @Results({
            @Result(property = "accountId", column = "account_id"),
            @Result(property = "accountPassword", column = "account_password"),
            @Result(property = "accountName", column = "account_name"),
            @Result(property = "accountAvatar", column = "account_avatar"),
            @Result(property = "accountPhone", column = "account_phone")
    })
    Account getAccountInfoByName(String account_name);


    @Select("SELECT * FROM account WHERE account_id = #{accountId}")
    @Results({
            @Result(property = "accountId", column = "account_id"),
            @Result(property = "accountPassword", column = "account_password"),
            @Result(property = "accountName", column = "account_name"),
            @Result(property = "accountAvatar", column = "account_avatar"),
            @Result(property = "accountPhone", column = "account_phone")
    })
    Account getAccountInfoById(Long accountId);
}
